﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;

namespace WFFSClients
{
    public partial class FrmAll : Form
    {
        public string pic = "";
        public FrmAll(string picname)
        {
            pic = picname;
            InitializeComponent();
        }

        private void FrmAll_Load(object sender, EventArgs e)
        {
            //Image img = new Bitmap(Application.StartupPath + "\\alldirective\\" + pic);
            //Drawing.Visible = true;
            //if (Drawing.Image != null)
            //{
            //    Drawing.Image.Dispose();
            //}
            //Drawing.Image = img;
        }

        private void FrmAll_FormClosed(object sender, FormClosedEventArgs e)
        {
            string x = this.Location.X.ToString();
            string y = this.Location.Y.ToString();
            WriteIniData("FrmAll", "X", x, Application.StartupPath + @"\WFFS.ini");
            WriteIniData("FrmAll", "Y", y, Application.StartupPath + @"\WFFS.ini");
        }

        public static bool WriteIniData(string Section, string Key, string Value, string iniFilePath)
        {
            if (File.Exists(iniFilePath))
            {
                long OpStation = WritePrivateProfileString(Section, Key, Value, iniFilePath);
                if (OpStation == 0)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                return false;
            }
        }
        [DllImport("kernel32")]
        private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);

        private void FrmAll_Paint(object sender, PaintEventArgs e)
        {
            //Image img = new Bitmap(Application.StartupPath + "\\alldirective\\" + pic);
            //Drawing.Visible = true;
            //if (Drawing.Image != null)
            //{
            //    Drawing.Image.Dispose();
            //}
            //Drawing.Image = img;
        }

        private void FrmAll_Activated(object sender, EventArgs e)
        {
           
        }
    }
}
